import React ,{Component}from 'react';
import { StyleSheet,} from 'react-native';
import CardStackStyleInterpolator from 'react-navigation/src/views/CardStack/CardStackStyleInterpolator';
import dismissKeyboard from 'react-native/Libraries/Utilities/dismissKeyboard'

import {
    Router,
    Reducer,
    Stack,
    Scene,
} from 'react-native-router-flux';
import './jscode/common/Global'
import LoginPage from "./jscode/page/LoginPage";
import ChatPage from "./jscode/page/ChatPage";
import ChatInterfacePage from "./jscode/page/ChatInterfacePage";
const reducerCreate = params => {
    const defaultReducer = new Reducer(params);
    return (state, action) => {
        return defaultReducer(state, action);
    };
};
const getSceneStyle = () => ({
    backgroundColor: '#F5FCFF',
    shadowOpacity: 1,
    shadowRadius: 3,
});
GLOBAL.XMLHttpRequest = GLOBAL.originalXMLHttpRequest || GLOBAL.XMLHttpRequest;
const App = () => (
    <Router>
      <Stack
          hideNavBar headerMode='screen' key="root"
          transitionConfig={()=>({
              screenInterpolator: CardStackStyleInterpolator.forHorizontal,
          })}
          onTransitionStart={()=>{
              dismissKeyboard();
          }}
          onTransitionEnd={()=>{

          }}
      >
        <Scene
            key="LoginPage"
            component={LoginPage}
            onExit={() => console.log('onExit')}
            title="登录"/>
        <Scene
            key="ChatPage"
            component={ChatPage}
            onExit={() => console.log('onExit')}
            title="聊天"/>
        <Scene
            key="ChatInterfacePage"
            component={ChatInterfacePage}
            onExit={() => console.log('onExit')}
            title="聊天内容"/>
      </Stack>
    </Router>
);

export default App;